//
// Created by Kame.Liang on 2021/9/4.
//

#ifndef UNTITLED1_LAZYSINGLETON_H
#define UNTITLED1_LAZYSINGLETON_H
#include <iostream>
template <class T>
class EagerSingleton{
public:
    static T& GetInstance(){
        return *t_;
    }

    EagerSingleton(T&&) = delete;
    EagerSingleton(const T&) = delete;
    void operator= (const T&) = delete;

protected:
    EagerSingleton() = default;
    virtual ~EagerSingleton() = default;

private:
    static T* t_;
};

template<typename T>
T* EagerSingleton<T>::t_ = new (std::nothrow) T;

#endif //UNTITLED1_LAZYSINGLETON_H
